package com.itqhy.pojo;

import java.util.Iterator;
import java.util.List;

public class Order {
    private String id; // 订单编号
    private String money; // 订单总价
    private String receiverAddress; // 收货地址
    private String receiverName; // 收件人姓名
    private String receiverPhone; // 收件人电话
    private int paystate; // 订单状态
    private String ordertime; //提交订单时的时间
    private int user_id;
    private List<OrderItem> orderItemList;//一个订单中可以有多个明细

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
   //计算订单总价
    public double getMoney(){
        double sum=0.0;

            Iterator<OrderItem> qhy=orderItemList.iterator();
            while (qhy.hasNext()){
               OrderItem od= qhy.next();
                sum += od.getProduct().getPrice()*od.getBuynum();
            }
        return sum;
    }

    public void setMoney(String money) {
        this.money = money;
    }

    public String getReceiverAddress() {
        return receiverAddress;
    }

    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }

    public String getReceiverName() {
        return receiverName;
    }

    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }

    public String getReceiverPhone() {
        return receiverPhone;
    }

    public void setReceiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
    }

    public int getPaystate() {
        return paystate;
    }

    public void setPaystate(int paystate) {
        this.paystate = paystate;
    }

    public String getOrdertime() {
        return ordertime;
    }

    public void setOrdertime(String ordertime) {
        this.ordertime = ordertime;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public List<OrderItem> getOrderItemList() {
        return orderItemList;
    }
    public void setOrderItemList(List<OrderItem> orderItemList) {
        this.orderItemList = orderItemList;
    }
}


